﻿using UnityEngine;
using System.Collections;

public class ShellExplosion : MonoBehaviour {

    public float maxLifeTime = 2f;
    public float damage = 10f;

    void Start () {
        Destroy(gameObject, maxLifeTime);
    }

    private void OnTriggerEnter(Collider other)
    {
        TankHealth tankHealth = other.GetComponent<TankHealth>();
        if (tankHealth)
        {
            tankHealth.TakeDamage(damage);
        }

        Destroy(gameObject);
    }
}
